/*
 * @Descripttion:
 * @version:
 * @Author: captern@icloud.com
 * @Date: 2023-05-09 10:07:26
 * @LastEditors: captern
 * @LastEditTime: 2023-05-09 10:48:12
 */
import type { PropType, ExtractPropTypes } from 'vue'
import { mapValues, without } from 'lodash-es'
import {
  type CommonComponentProps,
  type TextComponentProps,
  type ImageComponentProps
} from '@/types/defaultProps'
export const commonDefaultProps: CommonComponentProps = {
  // 行为
  actionType: '',
  url: '',
  // 尺寸
  height: '',
  width: '373px',
  paddingLeft: '0px',
  paddingRight: '0px',
  paddingTop: '0px',
  paddingBottom: '0px',
  // 边框样式
  borderStyle: 'none',
  borderColor: '#000',
  borderWidth: '0',
  borderRadius: '0',
  // 阴影 透明度
  boxShadow: '0 0 0 #000000',
  opacity: '1',
  // 位置
  position: 'absolute',
  left: '0',
  top: '0',
  right: '0'
}

export const textDefaultProps: TextComponentProps = {
  // 基本参数 -
  text: '默认样式',
  fontSize: '16px',
  fontFamily: '',
  fontWeight: 'normal',
  fontStyle: 'normal',
  textDecoration: 'none',
  lineHeight: '1',
  textAlign: 'left',
  color: '#000000',
  backgroundColor: '',
  ...commonDefaultProps
}

export const imageDefaultProps: ImageComponentProps = {
  src: 'test.url',
  ...commonDefaultProps
}
// 获取 文本组件 除其他属性外的 样式属性
export const textStylePropNames = without(
  Object.keys(textDefaultProps),
  'actionType',
  'url',
  'text'
)
export const imageStylePropsNames = without(Object.keys(imageDefaultProps), 'src')

// export const transformToComponentProps = <T extends {}>(props: T) => {
//   return mapValues(props, (item) => {
//     return {
//       type: (item as any).constructor as StringConstructor,
//       default: item
//     }
//   })
// }
